package de.jmda.gen.java.impl;

import javax.validation.constraints.NotNull;

import de.jmda.gen.GeneratorException;
import de.jmda.gen.java.InstanceMethodGenerator;
import de.jmda.gen.java.InterfaceGenerator;
import de.jmda.gen.java.TypeKindGenerator;

/**
 * @author roger.jmda@gmail.com
 */
public class DefaultInterfaceGenerator
		extends DefaultCompilationUnitTypeGenerator
		implements InterfaceGenerator
{
	public DefaultInterfaceGenerator()
	{
		super();
		
		getCompilationUnitTypeDeclarationGenerator()
				.getDeclaredTypeGenerator()
				.setTypeKindGenerator(TypeKindGenerator.INTERFACE);
	}

	@Override
  @NotNull
  public String getInterfaceName() throws GeneratorException
  {
	  return getCompilationUnitTypeName();
  }

	@Override
  public void setInterfaceName(@NotNull String interfaceName)
  {
		setCompilationUnitTypeName(interfaceName);
  }

	@Override
  public void addMethodDeclarationGenerator(InstanceMethodGenerator generator)
  {
		getCompilationUnitTypeDeclarationGenerator()
				.getDeclaredTypeGenerator()
		    .getTypeBodyGenerator()
		    .demandInstanceMethodDeclarationsGenerator()
		    .add(generator);
  }

	@Override
  public StringBuffer getExtendsClause() throws GeneratorException
  {
		return
				getCompilationUnitTypeDeclarationGenerator()
						.getDeclaredTypeGenerator()
						.demandExtendsClauseGenerator()
						.getExtendsClause();
  }

	@Override
  public void setExtendsClause(String extendsClause)
  {
		getCompilationUnitTypeDeclarationGenerator()
		    .getDeclaredTypeGenerator()
		    .demandExtendsClauseGenerator()
		    .setExtendsClause(extendsClause);
  }

//	@Override
//  public void setImplementsClause(String implementsClause)
//  {
//		getCompilationUnitTypeDeclarationGenerator()
//		    .getDeclaredTypeGenerator()
//		    .demandImplementsClauseGenerator()
//		    .setImplementsClause(implementsClause);
//  }
//
//	@Override
//  public StringBuffer getImplementsClause() throws GeneratorException
//  {
//		return
//				getCompilationUnitTypeDeclarationGenerator()
//						.getDeclaredTypeGenerator()
//						.demandImplementsClauseGenerator()
//						.getImplementsClause();
//  }

	@Override
  public void addAnnotation(Class<?> annotation, StringBuffer parameters)
  {
		getCompilationUnitTypeDeclarationGenerator()
				.demandAnnotationStatementsGenerator()
				.getAnnotationStatementGenerators()
				.add(new DefaultAnnotationStatementGenerator(annotation, parameters));
  }
}